class ConObjective extends UTGameObjective;

var(ConProperties) byte ConAssociatedStage;
var(ConProperties) int BaseHealth;
var(ConProperties) string ConObjectiveName;
var(ConProperties) byte ConOwnerTeam;
var(ConProperties) byte ConImportance;
var(ConProperties) enum EObjectiveTypes
{
	CO_Dest,
	CO_Hold,
	CO_King
} ConObjectiveType;

var repnotify bool bConComplete;
var repnotify float Health;
var ConSquadAI ConDefensiveSquad;
var ConSquadAI ConOffensiveSquad;

replication
{
	if (Role == ROLE_Authority)
		ConObjectiveType, Health, bConComplete;
}

simulated event PostBeginPlay()
{
	Reset();

	Super.PostBeginPlay();
}

simulated function Reset()
{
	Health = BaseHealth;
	bConComplete = false;
}

simulated function CheckHealth()
{
}

simulated event PostRenderFor(PlayerController PC, Canvas Canvas, vector CameraPosition, vector CameraDir)
{
        local float XL, HealthX;
        local vector ScreenLoc;

        ScreenLoc = Canvas.Project(Location) ;

    // make sure not clipped out
        if (screenLoc.X < 0 ||
                screenLoc.X >= Canvas.ClipX ||
                screenLoc.Y < 0 ||
                screenLoc.Y >= Canvas.ClipY)
        {
                return;
        }

       healthX = health*100/BaseHealth;
       XL = 100 ;
           class'UTHUD'.static.DrawHealth(ScreenLoc.X-0.5*XL, ScreenLoc.Y - 50, HealthX, XL, 20, Canvas);
}


function bool TellBotHowToHeal(UTBot B)
{
	return false;
}

function bool TellBotHowToDisable(UTBot B)
{
	return false;
}

function bool KillEnemyFirst(UTBot B)
{
	if (B.Enemy != None && B.Enemy.Controller != None 
		&& ((B.Enemy.Controller.Focus == B.Pawn) || (B.LastUnderFire > WorldInfo.TimeSeconds - 1.5))
		&& B.Enemy.CanAttack(B.Pawn) )
	{
		return true;
	} else {
		return false;
	}
}

function bool NearObjective(Pawn P)
{
	if (P.CanAttack(self))
		return true;

	return (VSize(Location - P.Location) < BaseRadius && P.LineOfSightTo(self));
}

DefaultProperties
{
	RemoteRole=ROLE_SimulatedProxy
	bConComplete=false
	ConOwnerTeam=0
	ConImportance=0
	name="ConObjective"
}